Finding the largest fixed-density necklace and Lyndon word
نویسندگان
چکیده
We present anO(n) time algorithm for finding the lexicographically largest fixed-density necklace of length n. Then we determine whether or not a given string can be extended to a fixed-density necklace of length n in O(n) time. Finally, we give an O(n) algorithm that finds the largest fixed-density necklace of length n that is less than or equal to a given string. The efficiency of the latter algorithm is a key component to allow fixed-density necklaces to be ranked efficiently. The results are extended to find the largest fixed-density Lyndon word of length n (that is less than or equal to a given string) in O(n) time.
منابع مشابه
Generalizing the Classic Greedy and Necklace Constructions of de Bruijn Sequences and Universal Cycles
We present a class of languages that have an interesting property: For each language L in the class, both the classic greedy algorithm and the classic Lyndon word (or necklace) concatenation algorithm provide the lexicographically smallest universal cycle for L. The languages consist of length n strings over {1, 2, . . . , k} that are closed under rotation with their subset of necklaces also be...
متن کاملA Gray code for fixed-density necklaces and Lyndon words in constant amortized time
This paper develops a constant amortized time algorithm to produce a cyclic cool-lex Gray code for fixed-density binary necklaces, Lyndon words, and pseudo-necklaces. It is the first Gray code for these objects that achieves this time bound. The algorithm is applied: (i) to develop a constant amortized time cyclic Gray code for necklaces, Lyndon words, and pseudo-necklaces ordered by density an...
متن کاملLinear Algorithms for Computing the Lyndon Border Array and the Lyndon Suffix Array
We consider the problem of finding repetitive structures and inherent patterns in a given string s of length n over a finite totally ordered alphabet. A border u of a string s is both a prefix and a suffix of s such that u 6= s. The computation of the border array of a string s, namely the borders of each prefix of s, is strongly related to the string matching problem: given a string w, find al...
متن کاملCounting Lyndon Factors
In this paper, we determine the maximum number of distinct Lyndon factors that a word of length n can contain. We also derive formulas for the expected total number of Lyndon factors in a word of length n on an alphabet of size σ, as well as the expected number of distinct Lyndon factors in such a word. The minimum number of distinct Lyndon factors in a word of length n is 1 and the minimum tot...
متن کاملA CAT Gray code for fixed-density necklaces and Lyndon words
This paper develops a constant amortized time algorithm to produce the cyclic cool-lex Gray code for fixed-density binary necklaces, Lyndon words, and pseudo-necklaces. It is the first Gray code for these objects that achieves this time bound. In addition to Gray code order, the algorithms can be easily modified to output the strings in co-lex order.
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Inf. Process. Lett.
دوره 125 شماره
صفحات -
تاریخ انتشار 2017